package us.norepeter.processing.textmatcher;

import java.util.Queue;

public class FilterChain extends TextProcessingChainLink implements Filterer {

	Queue<Scorer> scorers;
	String name;
	int threshold;
	
	FilterChain( String name, int threshold ) {
		this.name = name;
		this.threshold = threshold;
	}
	
	
	public boolean add(Scorer e) {
		return scorers.add(e);
	}



	public int size() {
		return scorers.size();
	}



	public boolean contains(Object o) {
		return scorers.contains(o);
	}



	public Scorer remove() {
		return scorers.remove();
	}

	public Scorer peek() {
		return scorers.peek();
	}

	@Override
	public boolean doesNotMeetThreshold(int score) {
		return score < threshold;
	}

	@Override
	public int getScore(Entity e1, Entity e2) {
		int sum = 0;
		for( Scorer scorer : scorers ) {
			sum += scorer.getScore(e1, e2);
		}
		return sum;
	}
	
}
